#ifndef __KSVGEDITOR_SVGDOCUMENT_KSVGFILEMANAGER_H_
#define __KSVGEDITOR_SVGDOCUMENT_KSVGFILEMANAGER_H_
#include <QDomElement>
#include <QList>

class QString;
class QRectF;
class QColor;
class QGraphicsScene;
class KExportShape;

class KSvgFileManager
{
public:
    KSvgFileManager();
    ~KSvgFileManager();

    static bool loadSvgFile(const QString& filePath,
        QList<KExportShape*>& shapeList,
        QRectF& sceneRect,
        QColor& canvasColor);

    static bool saveSvgFile(const QString& filePath,
        const QList<KExportShape*>& shapeList,
        const QRectF& sceneRect,
        const QColor& canvasColor);

private:
    static QDomElement createSvgRoot(QDomDocument& doc, const QRectF& sceneRect);
    static QDomElement createCanvasBackground(QDomDocument& doc, const QRectF& sceneRect, const QColor& color);
    static QDomElement createShapeGroup(QDomDocument& doc, const QList<KExportShape*>& shapeList);
    static void parseSvgElementRecursive(const QDomElement& elem,
        QList<KExportShape*>& shapeList,
        QColor& canvasColor,
        bool& backgroundSet);
};

#endif //__KSVGEDITOR_SVGDOCUMENT_KSVGFILEMANAGER_H_